API Docs (Javascript)
Overview
Name | Type | Description |
---|---|---|
Seeso | Class | Seeso is the main class for controlling and receiving gaze tracking and other related data. |
CameraConfiguration | Class | CameraConfiguration contains the configuration for the camera. |
GazeInfo | Class | GazeInfo contains information about the gaze position, tracking state, and eye movement state. |
FaceInfo | Class | FaceInfo contains information about the detected face. |
UserStatusOption | Class | UserStatusOption contains options for tracking user status, such as drowsiness and attention. |
TrackingState | constant object | TrackingState is an enumeration that represents the current state of gaze tracking. |
EyeMovementState | constant object | EyeMovementState is an enumeration that represents the current state of eye movement. |
CalibrationAccuracyCriteria | constant object | CalibrationAccuracyCriteria is an enumeration that represents the desired level of accuracy for calibration. |
onDebug | Function | onDebug is a callback function that provides performance monitoring information. |
onGaze | Function | onGaze is a callback function that provides gaze tracking information. |
onFace | Function | onFace is a callback function that provides facial landmark and expression information. |
onCalibrationNextPoint | Function | onCalibrationNextPoint is a callback function that signals the program to move to the next calibration point. |
onCalibrationProgress | Function | onCalibrationProgress is a callback function that provides progress information during calibration. |
onCalibrationFinished | Function | onCalibrationFinished is a callback function that provides the calibrated data after calibration is complete. |
onAttention | Function | onAttention is a callback function that provides information about the user's attention level. |
onBlink | Function | onBlink is a callback function that provides information about eye blinking. |
onDrowsiness | Function | onDrowsiness is a callback function that provides information about the user's drowsiness level. |
Seeso
class Seeso
Seeso
is a class that generates gaze tracking data using the camera stream of a device.
Constructor |
---|
Seeso() |
Seeso()
Seeso()
The Seeso
constructor doesn't take any arguments. To use gaze tracking, you need to first authenticate by calling the initialize function.
Example
const seeso = new Seeso()
initialize
async initialize(licenseKey, userStatusOption)
This asynchronous function authenticates the license key and starts the web assembly module. The UserStatusOption
parameter enables users to choose whether to turn on or off the UserStatusModule.
Parameters | Type | Description |
---|---|---|
licenseKey | String | Key generated from SeeSo console page |
userStatusOption | UserStatusOption | UserStatusOption is a value that enables or disables features related to UserStatus. |
Retrun Type | Description |
---|---|
InitializationErrorType | The initialize function returns the result of the initialization process. |
Example
this.seeso = new Seeso();
const errorCode = await this.seeso.initialize(licenseKey, userStatusOption);
if (errorCode === InitializationErrorType.ERROR_NONE) {
// Initialization succeeded
} else {
// Initialization failed, show error message to user
}
deinitialize
async deinitialize()
The deinitialize
function releases the memory used by the WebAssembly module, making it unavailable for use after this function is called.
Example
await this.seeso.deinitialize();
this.seeso = null;
startTracking
startTracking(stream)
startTracking
is a function that begins Gaze tracking through a given stream.
Parameters | Type | Description |
---|---|---|
stream | MediaStream | MediaStream is an object that streams media content such as video from a camera or other sources. |
Retrun Type | Description |
---|---|
boolean | Indicates whether the function is operating normally or not. |
Example
const stream = await navigator.mediaDevices.getUserMedia({'video': true});
this.started = await this.seeso.startTracking(stream);
if(this.started){
console.log(`started tracking.`)
}
stopTracking
stopTracking()
stopTracking
is a function that stops eye-tracking that was previously started by calling startTracking
. It takes no arguments, and when stopTracking
is called, the stream provided to startTracking
will be released and the gaze tracking feature will be disabled.
Example
const stream = await navigator.mediaDevices.getUserMedia({'video': true});
this.started = await this.seeso.startTracking(stream);
if(this.started){
this.seeso.stopTracking();
}
startCalibration
startCalibration(calibrationPoints, criteria)
startCalibration
is a function that begins calibration to improve the accuracy of gaze tracking.
Parameters | Type | Description |
---|---|---|
calibrationPoints | Number | The number of calibration points to show.(1, 5, 6) |
criteria | CalibrationAccuracyCriteria | The calibration accuracy criteria. |
Return Type | Description |
---|---|
boolean | Whether the function executed successfully. |
Example
const calibrationPoints = 5;
const criteria = CalibrationAccuracyCriteria.HIGH;
const success = seeSo.startCalibration(calibrationPoints, criteria);
if (success) {
console.log("Calibration started successfully!");
} else {
console.log("Failed to start calibration.");
}
stopCalibration
stopCalibration()
stopCalibration
is a function that stops the calibration process. It returns a boolean value indicating whether the function worked properly or not. The function does not require any input parameters.
Return Type | Description |
---|---|
boolean | Indicates success/fail. |
Example
this.seeso.stopCalibration();
console.log('Calibration stopped.');
startCollectSamples
startCollectSamples()
The startCollectSamples
function initiates the calibration sample collection process, guiding the user to look at predefined targets. This function must be called to perform the calibration process for the UI targets the user is looking at.
Example
onCalibrationNextPoint(pointX, pointY) {
// set up UI for calibration target
...
// call startCollectSamples function to begin calibration process for the target
seeso.startCollectSamples();
}
openCalibrationPageQuickStart
static openCalibrationPageQuickStart(licenseKey, userId, redirectUrl, calibrationPoint)
The openCalibrationPageQuickStart
function is used to quickly start the calibration process. It takes in the licenseKey, userId, redirectUrl, and calibrationPoint as parameters. The function then constructs a query string using these values, which is used to redirect the user to the calibration page.
Parameter | Type | Description |
---|---|---|
licenseKey | String | The license key for the SDK developer |
userId | String | The user ID for the calibration |
redirectUrl | String | The URL to redirect after calibration |
calibrationPoint | Number | The number of calibration points to display |
The function does not support mobile browser environments.
Example
const licenseKey = "my_license_key";
const userId = "user_id_1234";
const redirectUrl = "https://myapp.com/calibration/redirect";
const calibrationPoint = 5;
Seeso.openCalibrationPageQuickStart(licenseKey, userId, redirectUrl, calibrationPoint);
openCalibrationPage
static openCalibrationPage(licenseKey, userId, redirectUrl, calibrationPoint)
The openCalibrationPageStart
function is used to quickly start the calibration process. It takes in the licenseKey, userId, redirectUrl, and calibrationPoint as parameters. The function then constructs a query string using these values, which is used to redirect the user to the calibration page.
Parameter | Type | Description |
---|---|---|
licenseKey | String | The license key for the SDK developer |
userId | String | The user ID for the calibration |
redirectUrl | String | The URL to redirect after calibration |
calibrationPoint | Number | The number of calibration points to display |
The function does not support mobile browser environments.
Example
const licenseKey = "my_license_key";
const userId = "user_id_1234";
const redirectUrl = "https://myapp.com/calibration/redirect";
const calibrationPoint = 5;
Seeso.openCalibrationPageStart(licenseKey, userId, redirectUrl, calibrationPoint);
setCameraPosition
setCameraPosition(cameraX, isCameraOnTop)
The setCameraPosition function is used to set the position of the camera.
Parameter | Type | Description |
---|---|---|
cameraX | number | The x coordinate of the camera position in space. |
isCameraOnTop | boolean | Indicates whether the camera is on top or not |
The function does not support mobile browser environments.
Example
// Example usage of setCameraPosition function
const cameraX = 10;
const isCameraOnTop = true;
seeso.setCameraPosition(cameraX, isCameraOnTop);
getCameraPosition
getCameraPosition()
The getCameraPosition() function returns an object containing the current camera position.
Return Type | Description |
---|---|
Object | Returns an object with the current camera position, including isCameraOnTop and cameraX. Returns undefined if isCameraOnTop, cameraX is not defined. |
The function does not support mobile browser environments.
Example
const currentPosition = this.seeso.getCameraPosition();
console.log(`Current camera position: ${JSON.stringify(currentPosition)}`);
setCameraConfiguration
setCameraConfiguration(cameraConfig)
setCameraConfiguration
is a function in the Seeso SDK that changes the camera configuration. It accepts a parameter of type CameraConfiguration, which is a class that contains information about the camera's properties.
Parameter | Type | Description |
---|---|---|
cameraConfig | CameraConfiguration | CameraConfiguration class instance that holds camera properties. |
Only available on mobile browsers.
Example
if(seeso.checkMobile()){
// create a new instance of CameraConfiguration
const cameraConfig = new CameraConfiguration('DeviceName', 'ModelName', 1920, 1080, 401, 401, 0, 0, 1.11, false);
// set the camera configuration
seeso.setCameraConfiguration(cameraConfig);
}
getCameraConfiguration
getCameraConfiguration()
getCameraConfiguration
function is a SeeSo SDK function that fetches the currently configured camera information.
Return Type | Description |
---|---|
CameraConfiguration | containing the current camera properties. |
Only available on mobile browsers.
Example
if (this.seeso.checkMobile()) {
const cameraConfig = Seeso.getCameraConfiguration();
console.log(cameraConfig);
} else {
console.log('This function is only available on mobile browsers.');
}
setFaceDistance
setFaceDistance(faceDistance)
The setFaceDistance function sets the distance between the user's face and the camera.
Parameter | Type | Description |
---|---|---|
faceDistance | number | The distance between the user's face and the device in centimeters. |
The function does not support mobile browser environments.
Example
const faceDistance = 50;
this.seeso.setFaceDistance(faceDistance);
getFaceDistance
getFaceDistance()
The getFaceDistance function returns the distance between the user's face and the camera.
Return Type | Description |
---|---|
number | The distance between the user's face and the device in centimeters. |
The function does not support mobile browser environments.
Example
const currentDistance = myEyeTracker.getFaceDistance();
console.log(`The current face distance is ${currentDistance} cm`);
setMonitorSize
setMonitorSize(monitorInch)
The setMonitorSize function is used to set the user's monitor size in inches. This function takes in the monitor size as a parameter and sets it as a member variable.
Parameters | Type | Description |
---|---|---|
monitorInch | number | The size of the monitor in inches. |
Example
seeso.setMonitorSize(24);
setScreenSize
setScreenSize(widthMm, heightMm)
The setScreenSize
function is used to set the user's screen size.
Parameter | Type | Description |
---|---|---|
widthMm | number | The width of the screen in millimeters. |
heightMm | number | The height of the screen in millimeters. |
Example
// Set the screen size to 80mm x 120mm
seeso.setScreenSize(80, 120);
getMonitorSize
getMonitorSize()
The getMonitorSize
function returns the currently set monitor size in inches as a result.
Return Type | Description |
---|---|
number | The current monitor size in inches |
Example
const monitorSize = seeso.getMonitorSize();
console.log(`Current monitor size: ${monitorSize} inches`);
setTrackingFps
setTrackingFps(fps)
The setTrackingFps
function is used to set the gaze tracking FPS (frame per second).
Parameter | Type | Description |
---|---|---|
fps | Number | The FPS value to be set for gaze tracking. |
Example
seeso.setTrackingFps(15);
fetchCalibrationData
async fetchCalibrationData(userId)
The fetchCalibrationData
function takes a userId as an argument and fetches the user's calibration data.
Parameter | Type | Description |
---|---|---|
userId | string | The ID of the user whose calibration data to fetch |
Return Type | Description |
---|---|
string | The user's calibration data as string. Returns an empty string if the retrieval fails. |
async function fetchUserCalibrationData(userId) {
const calibrationData = await seeso.fetchCalibrationData(userId);
if (calibrationData !== '') {
// calibration data exists, do something with it
} else {
// no calibration data exists for this user
}
}
uploadCalibrationData
async uploadCalibrationData(userId)
The uploadCalibrationData
function takes a userId
as an argument and uploads the user's calibration data.
Parameter | Type | Description |
---|---|---|
userId | string | The user ID to upload the calibration data for. |
Return Type | Description |
---|---|
boolean | Returns true if calibration data was successfully uploaded, false otherwise |
Example
async function handleCalibrationUpload(userId) {
try {
const success = await seeso.uploadCalibrationData(userId);
if (success) {
console.log("Calibration data upload successful");
} else {
console.log("Calibration data upload failed");
}
} catch (error) {
console.log("Error uploading calibration data: ", error);
}
}
handleCalibrationUpload("user123");
setCalibrationData
async setCalibrationData(calibrationData)
setCalibrationData
function is a function that sets the calibration data.
Parameter | Type | Description |
---|---|---|
calibrationData | string | The calibration data to be set. |
Example
async function setCalibration() {
// fetch calibration data from database or other source
const calibrationData = await fetchCalibrationData('user123');
// set the calibration data
seeso.setCalibrationData(calibrationData);
}
getCalibrationData
getCalibrationData()
The getCalibrationData
function gets the current calibration data.
Return Type | Description |
---|---|
string | The current calibration data, if it exists. |
null | If no calibration data exists, returns null. |
Example
const calibrationData = seeso.getCalibrationData();
// if calibration data exists, log it to the console
// otherwise, log an error message
if (calibrationData) {
console.log("Calibration data: " + calibrationData);
} else {
console.error("No calibration data found.");
}
setAttentionInterval
setAttentionInterval(interval)
The setAttentionInterval
function adjusts the interval at which the onAttention callback function is called. The interval value is in seconds.
Example
// Set attention interval to 20 seconds
seeso.setAttentionInterval(20);
setAttentionRegion
setAttentionRegion(left, top, right, bottom)
The setAttentionRegion
function is used to set the Attention region for the onAttention callback function.
Parameter | Type | Description |
---|---|---|
left | number | The left position of the attention region. |
top | number | The top position of the attention region. |
right | number | The right position of the attention region. |
bottom | number | The bottom position of the attention region. |
Example
// Set the region of attention as the rectangular area from (100, 100) to (500, 500)
seeso.setAttentionRegion(100, 100, 500, 500);
getAttentionScore
getAttentionScore()
The getAttentionScore()
function retrieves the current user's attention score.
Return Type | Description |
---|---|
float | The current attention score of the user, as a float value. |
Example
const attentionScore = seeso.getAttentionScore();
console.log(`Attention Score: ${attentionScore}`);
checkMobile
checkMobile()
The checkMobile
function is used to determine whether the current browser being used is a mobile browser or not.
Return Type | Description |
---|---|
boolean | Returns true if the current browser is a mobile browser, else false. |
Example
if (this.seeso.checkMobile()) {
console.log('Mobile Browser Detected');
} else {
console.log('Desktop Browser Detected');
}
getVersionName
static getVersionName()
The getVersionName function is a function that returns the version name of the current Seeso SDK.
Return Type | Description |
---|---|
string | The version name. |
Example
const versionName = Seeso.getVersionName();
console.log(versionName); // logs the version name
showImage
showImage()
The showImage
function is used to display the current camera stream.
preview canvas must be included in the page for this function to work.
Example
const canvas = document.getElementById("preview");
if(canvas) {
seeso.showImage();
}
hideImage
hideImage()
The hideImage()
function in SeeSo SDK is used to hide the current camera stream being displayed.
preview canvas must be included in the page for this function to work.
Example
seeso.hideImage();
setDebugMode
setDebugMode(isDebug)
The setDebugMode
function allows you to configure whether to print logs when in debug mode. By setting isDebug to true, logs associated with SeeSo will be displayed.
Parameter | Type | Description |
---|---|---|
isDebug | boolean | Determines whether logs associated with SeeSo will be displayed when in debug mode. If set to true, logs will be printed. |
Example
function showSeeSoLogs() {
seeso.setDebugMode(true);
}
addDebugCallback
addDebugCallback(callback)
The addDebugCallback
function in Seeso SDK takes a callback function as a parameter, which is composed of the onDebug(FPS, latency_min, latency_max, latency_avg) function.
Parameter | Type | Description |
---|---|---|
callback | function | The function to call on debug. |
Example
function addCalbacks(){
seeso.addDebugCallback(onDebug);
...
}
function onDebug(FPS, latency_min, latency_max, latency_avg) {
console.log(`FPS: ${FPS}`);
console.log(`Latency min: ${latency_min}`);
console.log(`Latency max: ${latency_max}`);
console.log(`Latency avg: ${latency_avg}`);
}
removeDebugCallback
removeDebugCallback(callback)
removeDebugCallback
function is used to remove a debug callback function previously added by addDebugCallback
.
Parameter | Type | Description |
---|---|---|
callback | function | The function to call on debug. |
Example
function removeCallbacks(){
seeso.removeDebugCallback(onDebug);
}
function onDebug(FPS, latency_min, latency_max, latency_avg) {
console.log(`FPS: ${FPS}`);
console.log(`Latency min: ${latency_min}`);
console.log(`Latency max: ${latency_max}`);
console.log(`Latency avg: ${latency_avg}`);
}
addGazeCallback
addGazeCallback(callback)
The addGazeCallback
function takes a callback function in the form of onGaze(gazeInfo).
Parameter | Type | Description |
---|---|---|
callback | function | The callback function. The function must be in the form of onGaze(gazeInfo). |
Example
function addCallbacks() {
seeso.addGazeCallback(onGaze);
// ...
}
function onGaze(gazeInfo) {
console.log(`Timestamp: ${gazeInfo.timestamp}`);
console.log(`Gaze position (x, y): (${gazeInfo.x}, ${gazeInfo.y})`);
console.log(`Fixation position (x, y): (${gazeInfo.fixationX}, ${gazeInfo.fixationY})`);
console.log(`Left eye openness: ${gazeInfo.leftOpenness}`);
console.log(`Right eye openness: ${gazeInfo.rightOpenness}`);
console.log(`Tracking state: ${gazeInfo.trackingState}`);
console.log(`Eye movement state: ${gazeInfo.eyemovementState}`);
}
removeGazeCallback
removeGazeCallback(callback)
removeGazeCallback
function removes the specified callback function from the gaze callback list. The gaze callback is registered by calling addGazeCallback
function.
Parameter | Type | Description |
---|---|---|
callback | function | the callback function to be removed from Seeso. |
Example
// Define callback function
function onGaze(gazeInfo) {
console.log(gazeInfo);
}
// Add callback function
seeso.addGazeCallback(onGaze);
// Remove callback function
seeso.removeGazeCallback(onGaze);
addFaceCallback
addFaceCallback(callback)
addFaceCallback
function is a method in SeeSo SDK that sets a callback function to be called when face detection is performed. The callback function should have the form of onFace(faceInfo).
Parameter | Type | Description |
---|---|---|
callback | function | the function that will be called on face information |
Example
function addCallbacks() {
seeso.addFaceCallback(onFace);
// other callback functions can also be added here
}
function onFace(faceInfo) {
console.log(`Face score: ${faceInfo.score}`);
console.log(`Face position: (${faceInfo.left}, ${faceInfo.top}) - (${faceInfo.right}, ${faceInfo.bottom})`);
}
removeFaceCallback
removeFaceCallback(callback)
The removeFaceCallback
function is used to remove a callback function registered with addFaceCallback
function.
Parameter | Type | Description |
---|---|---|
callback | Function | callback function to remove |
Example
function removeCallbacks() {
seeso.removeFaceCallback(onFace);
}
function onFace(faceInfo) {
console.log(`Face score: ${faceInfo.score}`);
console.log(`Face position: (${faceInfo.left}, ${faceInfo.top}) - (${faceInfo.right}, ${faceInfo.bottom})`);
}
addCalibrationNextPointCallback
addCalibrationNextPointCallback(callback)
addCalibrationNextPointCallback
function is used to register a callback function that will be invoked when the next calibration point is displayed during the calibration process. The callback should have the following form: onCalibrationNextPoint(pointX, pointY).
Parameter | Type | Description |
---|---|---|
callback | function | A callback function to receive next calibration point coordinates. |
Example
function addCalibrationNextPointCallbackExample() {
seeso.addCalibrationNextPointCallback(onCalibrationNextPoint);
}
function onCalibrationNextPoint(pointX, pointY) {
console.log(`Next calibration point: (${pointX}, ${pointY})`);
}
removeCalibrationNextPointCallback
removeCalibrationNextPointCallback(callback)
removeCalibrationNextPointCallback
function removes the callback function added using addCalibrationNextPointCallback
function.
Parameter | Type | Description |
---|---|---|
callback | function | The callback function that was previously registered using addCalibrationNextPointCallback . |
Example
function onCalibrationNextPoint(pointX, pointY) {
console.log(`Next calibration point: (${pointX}, ${pointY})`);
}
// Add the callback
seeso.addCalibrationNextPointCallback(onCalibrationNextPoint);
// Remove the callback
seeso.removeCalibrationNextPointCallback(onCalibrationNextPoint);
addCalibrationProgressCallback
addCalibrationProgressCallback(callback)
addCalibrationProgressCallback
is a function that registers a callback function of the form onCalibrationProgress(progress).
Parameter | Type | Description |
---|---|---|
callback | function | It is a callback function in the form of onCalibrationProgress(progress). |
Example
function addCalibrationCallbacks() {
seeso.addCalibrationProgressCallback(onCalibrationProgress);
}
function onCalibrationProgress(progress) {
console.log(`Calibration progress: ${progress}`);
}
removeCalibrationProgressCallback
removeCalibrationProgressCallback(callback)
The removeCalibrationProgressCallback
function removes the registered callback function added by addCalibrationProgressCallback
function.
Parameter | Type | Description |
---|---|---|
callback | function(progress) | The parameter callback is the previously registered callback function using the addCalibrationProgressCallback function. |
Example
const callback = (progress) => {
console.log(`Calibration progress: ${progress}`);
};
seeso.addCalibrationProgressCallback(callback);
.....
// Later, if you want to remove the callback:
seeso.removeCalibrationProgressCallback(callback);
addCalibrationFinishCallback
addCalibrationFinishCallback(callback)
addCalibrationFinishCallback
function takes a callback function as a parameter in the form of onCalibrationFinished(calibrationData). This callback function is called when the calibration process is finished, and it receives an object calibrationData containing the calibration data as its parameter.
Parameter | Type | Description |
---|---|---|
callback | function | The callback function to be called when calibration is finished. |
Example
const calibrationFinishCallback = (calibrationData) => {
console.log(`Calibration finished with data: ${JSON.stringify(calibrationData)}`);
};
addCalibrationFinishCallback(calibrationFinishCallback);
removeCalibrationFinishCallback
removeCalibrationFinishCallback(callback)
The removeCalibrationFinishCallback
function removes the previously registered callback function with addCalibrationFinishCallback
function.
Parameter | Type | Description |
---|---|---|
callback | function | The callback function to be removed. It should be the same function that was passed to addCalibrationFinishCallback . |
Example
const myCalibrationFinishCallback = (calibrationData) => {
console.log('Calibration finished!');
console.log(calibrationData);
};
// Add the callback function to the list of calibration finish callbacks
myTracker.addCalibrationFinishCallback(myCalibrationFinishCallback);
// ...
// Remove the callback function from the list of calibration finish callbacks
myTracker.removeCalibrationFinishCallback(myCalibrationFinishCallback);
addAttentionCallback
addAttentionCallback(callback)
The addAttentionCallback
function is used to register the ponAttention(timestampBegin, timestampEnd, score) function as a callback.
Parameter | Type | Description |
---|---|---|
callback | function | The callback function to register with the SDK. It should be in the form of onAttention(timestampBegin, timestampEnd, score). |
Example
const callback = (timestampBegin, timestampEnd, score) => {
console.log(`Attention event occurred between ${timestampBegin} and ${timestampEnd}. Score: ${score}`);
};
gazeDetector.addAttentionCallback(callback);
removeAttentionCallback
removeAttentionCallback(callback)
The removeAttentionCallback
function removes the callback function registered with addAttentionCallback
function.
Parameter | Type | Description |
---|---|---|
callback | function | The function to be removed as a callback. |
Example
const callback = (timestampBegin, timestampEnd, score) => {
console.log(`Attention: ${score} (from ${timestampBegin} to ${timestampEnd})`);
};
// Register the callback function
awrtc.addAttentionCallback(callback);
// Unregister the callback function
awrtc.removeAttentionCallback(callback);
addBlinkCallback
addBlinkCallback(callback)
addBlinkCallback
function is used to register the onBlink(timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness) function as a callback.
Parameter | Type | Description |
---|---|---|
callback | function | The callback function to register, in the form of onBlink(timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness). |
Example
seeso.addBlinkCallback((timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness) => {
// Do something with the blink data
console.log(`Blink detected at ${timestamp}`);
});
removeBlinkCallback
removeBlinkCallback(callback)
The removeBlinkCallback
function is used to remove a callback function registered by the addBlinkCallback
function.
Parameter | Type | Description |
---|---|---|
callback | function | Callback function to remove, which was registered by addBlinkCallback() function. |
Example
function onBlink(timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness) {
console.log(`Blink detected at ${timestamp}`);
}
seeso.addBlinkCallback(onBlink);
seeso.removeBlinkCallback(onBlink);
addDrowsinessCallback
addDrowsinessCallback(callback)
The addDrowsinessCallback
function is used to register a callback function in the form of onDrowsiness(timestamp, isDrowsiness).
Parameter | Type | Description |
---|---|---|
callback | function | The callback parameter is a function in the form of onDrowsiness(timestamp, isDrowsiness) that you want to register. |
Example
// Define a callback function to be executed when drowsiness is detected
function onDrowsiness(timestamp, isDrowsiness) {
console.log(`Drowsiness detected at ${timestamp}. Drowsiness state: ${isDrowsiness}`);
}
// Register the callback function with the seeSo instance
seeSo.addDrowsinessCallback(onDrowsiness);
removeDrowsinessCallback
removeDrowsinessCallback(callback)
The removeDrowsinessCallback
function removes the callback function registered with addDrowsinessCallback
function.
Parameter | Type | Description |
---|---|---|
callback | function | The callback function to be removed, which is the function registered with addDrowsinessCallback . |
Example
function onDrowsiness(timestamp, isDrowsy) {
if (isDrowsy) {
console.log(`You are drowsy at ${timestamp}`);
} else {
console.log(`You are not drowsy at ${timestamp}`);
}
}
// Add the callback function
seeSo.addDrowsinessCallback(onDrowsiness);
// Later, remove the callback function
seeSo.removeDrowsinessCallback(onDrowsiness);
CameraConfiguration
class CameraConfiguration
The CameraConfiguration
class is a class that contains camera configuration information used in Seeso
. It is used in mobile browsers.
The CameraConfiguration
object is set in Seeso using the setCameraConfiguration()
function. Through this, Seeso can recognize the user's gaze accurately by determining the appropriate screen size, physical distance between the screen and the camera, and other factors.
Variable | Type | Description |
---|---|---|
deviceName | string | The ID of the device referred to in code. |
modelName | string | The model name of the device. |
resolutionWidth | number | The width of the camera resolution. |
resolutionHeight | number | The height of the camera resolution. |
ppiX | number | The horizontal pixel density of the screen. |
ppiY | number | The vertical pixel density of the screen. |
screenOriginX | number | The horizontal size in millimeters of the physical distance between the camera and screen. |
screenOriginY | number | The vertical size in millimeters of the physical distance between the camera and screen. |
fov | number | The camera's field of view in radians. |
cameraOnLongerAxis | boolean | Whether the camera is positioned along the longer axis. |
GazeInfo
class GazeInfo
GazeInfo
is a class used in Seeso
to contain gaze information, including the user's gaze coordinates and various states.
Variable | Type | Description |
---|---|---|
timestamp | number | Timestamp of the gaze data in milliseconds |
x | number | X coordinate of gaze point in screen space (When the upper-left corner of the screen is (0,0)) |
y | number | Y coordinate of gaze point in screen space (When the upper-left corner of the screen is (0,0)) |
fixationX | number | X coordinate of fixation point in screen space (When the upper-left corner of the screen is (0,0)) |
fixationY | number | Y coordinate of fixation point in screen space (When the upper-left corner of the screen is (0,0)) |
leftOpenness | number | Openness value of the left eye (0.0~1.0) |
rightOpenness | number | Openness value of the right eye (0.0~1.0) |
trackingState | TrackingState | State of the gaze tracker |
eyemovementState | EyeMovementState | State of the eye movement |
FaceInfo
class FaceInfo
FaceInfo
is a class in Seeso
that contains information about the user's face, including the position, size, and orientation. It is used to track the user's facial movements and expressions.
Variable | Type | Description |
---|---|---|
timestamp | number | Time when the face information was captured |
score | number | The score indicating the accuracy of the face recognition |
left | number | The x-coordinate of the left-most point of the face rectangle |
top | number | The y-coordinate of the top-most point of the face rectangle |
right | number | The x-coordinate of the right-most point of the face rectangle |
bottom | number | The y-coordinate of the bottom-most point of the face rectangle |
pitch | number | The pitch of the face in degrees |
yaw | number | The yaw of the face in degrees |
centerX | number | The distance between the center of the face and the camera in millimeters (mm) along the x-axis |
centerY | number | The distance between the center of the face and the camera in millimeters (mm) along the y-axis |
centerZ | number | The distance between the center of the face and the camera in millimeters (mm) along the z-axis |
UserStatusOption
class UserStatusOption
The UserStatusOption
class is a class that contains information about the user's status in Seeso
.
This class is used when calling the initialize function, and depending on the variables passed, it determines whether to use the attention
, blink
, and drowsiness
functions. These three functions are used to inquire about usage when performing more operations
to create them.
Therefore, the UserStatusOption class is used to appropriately configure the functions necessary for tracking and analyzing the user's status in Seeso.
Parameter | Type | Description |
---|---|---|
isUseAttention | boolean | Whether to use attention tracking functionality |
isUseBlink | boolean | Whether to use blink tracking functionality |
isUseDrowsiness | boolean | Whether to use drowsiness tracking functionality |
TrackingState
export const TrackingState = Object.freeze({
SUCCESS: 0,
LOW_CONFIDENCE: 1,
UNSUPPORTED: 2,
FACE_MISSING: 3,
});
The TrackingState
constant object is an enumeration that represents the face tracking state in Seeso. These tracking states are used in the GazeInfo object.
SUCCESS
indicates a successfully tracked state.LOW_CONFIDENCE
indicates a tracked state with low confidence.UNSUPPORTED
indicates an unsupported tracking state.FACE_MISSING
indicates a state where a face is not detected.
EyeMovementState
export const EyeMovementState = Object.freeze({
FIXATION: 0,
SACCADE: 2,
UNKNOWN: 3,
});
EyeMovementState
is an enumeration in Seeso
that represents the state of eye movement. These eye movement states are used in the GazeInfo object.
FIXATION
indicates that the pupil is stationary.SACCADE
indicates rapid movement of the pupil.UNKNOWN
indicates an unknown state of eye movement.
CalibrationAccuracyCriteria
export const CalibrationAccuracyCriteria = Object.freeze({
DEFAULT: 0,
LOW: 1,
HIGH: 2,
});
CalibrationAccuracyCriteria
is an enum constant object used as a parameter for the startCalibration
function. The startCalibration
function performs calibration to accurately track the user's gaze information, and the CalibrationAccuracyCriteria
parameter can be used to set the accuracy criteria for the calibration. This parameter can be set to one of DEFAULT
, LOW
, or HIGH
, which represent the default, low, and high accuracy criteria, respectively.
onDebug
onDebug(FPS, latency_min, latency_max, latency_avg)
The onDebug
function is one of the callback functions used in Seeso
that provides performance monitoring information. It is called every time the onGaze
function is executed and receives current frame rate (FPS), minimum and maximum latency time (latency_min, latency_max), and average latency time (latency_avg) as arguments. This function can be used to monitor and debug the performance of the program.
onGaze
onGaze(gazeInfo)
The onGaze
function is one of the callback functions used in Seeso
. This function takes a GazeInfo object as an argument.
onFace
onFace(faceInfo)
The onFace
function is one of the callback functions used in Seeso
. This function takes a FaceInfo object as an argument.
onCalibrationNextPoint
onCalibrationNextPoint(pointX, pointY)
The onCalibrationNextPoint
function is one of the callback functions used in Seeso
. This function is used to signal the program to move to the next point during the calibration process. In other words, this function is responsible for notifying the program to move to the next calibration point after the measurement is completed at the current calibration point. This function is automatically called during the calibration process and does not
need to be called directly by the developer.
onCalibrationProgress
onCalibrationProgress(progress)
The onCalibrationProgress
function is one of the callback functions used in Seeso
. This function is used to inform the program of the progress of the calibration process. In other words, this function tracks the progress of the current target during the calibration process and provides that information to the developer. This function is automatically called during the calibration process and does not need to be called directly by the developer. The function takes a progress argument that represents the current calibration progress, which has a value between 0.0 and 1.0.
onCalibrationFinished
onCalibrationFinished(calibrationData)
The onCalibrationFinished
function is one of the callback functions used in Seeso
. This function is called when the calibration process is completed. It receives a CalibrationData
object that contains the calibrated data. The CalibrationData
object stores the parameters used for eye tracking in Seeso. Therefore, this function allows developers to obtain the extracted parameters from the calibration process. This function is automatically called when the calibration process is completed and does not need to be called directly by the developer.
onAttention
onAttention(timestampBegin, timestampEnd, score)
The onAttention
function is one of the callback functions used in Seeso
. It is used to track the user's attention level and provides detailed information about the tracked attention level. The function takes three parameters as input: timestampBegin
, timestampEnd
, and score
.
The timestampBegin
parameter represents the time when the attention tracking started, while timestampEnd
represents the time when the attention tracking ended. The score
parameter represents the tracked attention level, and its value is a float between 0 and 1.
onBlink
onBlink(timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness)
The onBlink
function is one of the callback functions used in Seeso
. This function is used to track eye blink information. The function provides detailed information about the tracked eye blink. It takes six parameters as input: timestamp
, isBlinkLeft
, isBlinkRight
, isBlink
, leftOpenness
, and rightOpenness
.
The timestamp
parameter indicates the time when the eye blink was detected. The isBlinkLeft
and isBlinkRight
are Boolean variables that indicate whether the left and right eye blinked, respectively. The isBlink
parameter is also a Boolean variable that indicates whether both eyes blinked simultaneously. The leftOpenness
and rightOpenness
are float variables that represent the degree of openness of the left and right eyes, respectively.
This function enables the tracking and analysis of eye blink information and the analysis of the eye state.
onDrowsiness
onDrowsiness(timestamp, isDrowsiness, intensity)
The onDrowsiness
function is one of the callback functions used in Seeso
. This function is used to track the user's drowsiness state. The function provides detailed information about the tracked drowsiness state. It takes two parameters as input: timestamp
and isDrowsiness
.
The timestamp
parameter indicates the time when the drowsiness state was detected, and the isDrowsiness
parameter is a Boolean variable that indicates whether the user is currently drowsy or not. This function enables the tracking of the user's drowsiness state and allows appropriate actions to be taken by the program.
The intensity
parameter in the onDrowsiness function represents the intensity or level of drowsiness detected. It is a floating-point value ranging from 0 to 1.
The intensity
value provides additional information about the severity or strength of the drowsiness state. A value of 0 indicates no drowsiness or low drowsiness intensity, while a value of 1 represents high drowsiness intensity.